const Router = require('koa-router')
const router = new Router()

const {
    getAllMovies,
    getMovieDetail,
    getRelativeMovies
} = require('../service/movie')


const routers = router
    .get('/', async(ctx, next) => {
        let title = 'hello api跟目录'
        console.log(ctx.query)
        const query = ctx.query
        ctx.session.user = {
            name: 'JaceTwo0000',
            age: 20000
        }
        
        const movies = await getAllMovies(query)
        ctx.body = {
            success: true,
            data: movies
        }



    }).get('/user', async(ctx, next) => {
        let title = 'hello 跟user'
        console.log(ctx)
        console.log(ctx.session)
        ctx.body = [{ a: '1' }, { b: '2' }, { c: '3' }]
    })

module.exports = routers